﻿@model IEnumerable<CloudFranceTriple.Models.PrivateMessageBoxSet>
<tr>
    <td colspan="5">
        <h2>@CloudFranceTriple.WebRole.Properties.Resources.PrivateMessageReceivedTitle (@Model.Count())</h2>
    </td>
</tr>
<tr>
    <th>
        @CloudFranceTriple.WebRole.Properties.Resources.PrivateMessageSubject
    </th>
    <th>
        @CloudFranceTriple.WebRole.Properties.Resources.PrivateMessageAuthor
    </th>
    <th>
        @CloudFranceTriple.WebRole.Properties.Resources.PrivateMessageCreationDate
    </th>
    <th></th>
</tr>
 @{ViewBag.LastParentId = 0;}
@foreach (var item in Model)
{
    <tr>
        <td>@if (ViewBag.LastParentId == item.ParentId)
           {
                @String.Format("|--- {0}",Html.DisplayFor(modelItem => item.MessageBody_Label))
            }
            else
            {
                @Html.DisplayFor(modelItem => item.MessageBody_Label)
            }

        </td>
        <td>
            @Html.DisplayFor(modelItem => item.MessageBody_Author)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.MessageBody_CreationDate,"TemplateUserDateTime")
        </td>
        <td>
            @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonRead, "Details", "PrivateMessage", new { id = item.Id, area = "Forum" }, null) |
            @Html.ActionLink(@CloudFranceTriple.WebRole.Properties.Resources.ButtonAnswer, "Create", "PrivateMessage", new { area = "Forum", id = item.FromPrivateMessage, id2 = ((item.ParentId == null) ? item.Id : item.ParentId) }, null) |
            @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonDelete, "Delete", "PrivateMessage", new { id = item.Id, area = "Forum" }, null)
        </td>
    </tr>
    ViewBag.LastParentId = item.ParentId;
}